import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mac
 * Date: 2022-10-22
 * Time: 20:05
 */
class Node {
    int val;
    Node next;
    Node random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }
}
public class Problem {
    //136.只出现一次的数字
    public int singleNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if (set.contains(nums[i])){
                set.remove(nums[i]);
            }else{
                set.add(nums[i]);
            }
        }
        Iterator<Integer> it = set.iterator();
        return it.next();
    }

    //138.复制带随机指针的链表
    public Node copyRandomList(Node head) {
        Map<Node, Node> map = new HashMap<>();
        Node cur = head;
        while (cur != null){
            Node newNode = new Node(cur.val);
            map.put(cur, newNode);
            cur = cur.next;
        }
        cur = head;
        while (cur != null){
            map.get(cur).next = map.get(cur.next);
            map.get(cur).random = map.get(cur.random);//奥秘
            cur = cur.next;
        }

        return map.get(head);
    }
    //额外空间为O(1)
    public Node copyRandomList1(Node head) {
        return new Node(head.val);
    }
    //771.宝石与石头
    public int numJewelsInStones(String jewels, String stones) {
        List<Character> list = new ArrayList<>();
        for (int i = 0; i < jewels.length(); i++) {
            list.add(jewels.charAt(i));
        }
        int count = 0;
        for (int i = 0; i < stones.length(); i++) {
            if (list.contains(stones.charAt(i))){
                count++;
            }
        }
        return count;
    }

    //牛客20.旧键盘
    public static void findBrokeBoard(String strput, String strout){
        Set<Character> set = new HashSet<>();
        for (char c: strout.toUpperCase().toCharArray()) {
            set.add(c);
        }
        Set<Character> set1 = new HashSet<>();
        for (char c: strput.toUpperCase().toCharArray()){
            if (!set.contains(c) && !set1.contains(c)){
                System.out.print(c);
                set1.add(c);
            }
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()){
            String strput = scanner.nextLine();
            String strout = scanner.nextLine();
            findBrokeBoard(strput, strout);
        }
    }

    //692.前k个高频单词
    public List<String> topKFrequent(String[] words, int k) {
        Map<String, Integer> map = new HashMap<>();
        for(String str: words){
            if (map.get(str) == null){
                map.put(str, 1);
            }else{
                int count = map.get(str);
                map.put(str, count + 1);
            }
        }

        PriorityQueue<Map.Entry<String, Integer>> pq = new PriorityQueue<>(k, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                if (o1.getValue().compareTo(o2.getValue()) == 0){
                    return o2.getKey().compareTo(o1.getKey());
                }
                return o1.getValue() - o2.getValue();
            }
        });

        for (Map.Entry<String, Integer> entry: map.entrySet()){
            if (map.size() < k){
                pq.add(entry);
            }else{
                Map.Entry<String, Integer> top = pq.peek();
                if (top.getValue().compareTo(entry.getValue()) == 0){
                    if (top.getKey().compareTo(entry.getKey()) > 0){
                        pq.poll();
                        pq.add(entry);
                    }
                }else{
                    if (top.getValue().compareTo(entry.getValue()) < 0){
                        pq.poll();
                        pq.add(entry);
                    }
                }
            }
        }
        List<String> list = new ArrayList<>();
        for (int i = 0; i < k; i++) {
            list.add(pq.poll().getKey());
        }
        Collections.reverse(list);

        return list;
    }



}
